package org.toy.maxent;

import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 
 * @author weip.pengw
 * @time 2010-9-1 下午11:04:38
 */
public class MultiFieldContextGeneratorSupport {

	private final static Pattern pattern = Pattern
			.compile("<([\\w\\-_]+)\\:([^<>]+)>");

	public static List<String> toContextList(String s) {
		Matcher matcher = pattern.matcher(s);
		List<String> tagList = new ArrayList<String>();
		while (matcher.find()) {
			tagList.add(new StringBuffer().append(matcher.group(1)).append(":")
					.append(matcher.group(2)).toString());
		}

		return tagList;
	}

}
